package com.intmall.security.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {

//    @Secured("ROLE_normal")
    @PreAuthorize("hasRole('normal')")
    @RequestMapping("toMain")
    public String toMain() {
        System.out.println("toMain.....");
        return "redirect:main.html";
    }

    @RequestMapping("toFail")
    public String toFail() {
        System.out.println("toFail.....");
        return "redirect:fail.html";
    }

    @GetMapping("/demo")
    public String demo() {
        return "demo";
    }
}
